package cn.org.mrliu.ssm.common.web.filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginFilter implements Filter {
    public LoginFilter() {
    }

	public void destroy() {
	}
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
		System.out.println("LoginFilter...........");
		HttpServletRequest httpRequest = (HttpServletRequest) request;
		HttpServletResponse httpResponse = (HttpServletResponse) response;
		//项目名称
		String contextPath = httpRequest.getContextPath();
		//请求路径
		String path = httpRequest.getServletPath();
		//请求路径(带项目名称)
		String uri = httpRequest.getRequestURI();
		//请求路径(全路径)
		String url = String.valueOf(httpRequest.getRequestURL());
		System.out.println(contextPath);
		System.out.println(path);
		System.out.println(uri);
		System.out.println(url);
		System.out.println(httpRequest.getPathInfo());
		System.out.println(httpRequest.getQueryString());
		System.out.println(httpRequest.getContentType());
		System.out.println(httpRequest.getScheme());
		System.out.println(httpRequest.getServerName());
		System.out.println(httpRequest.getMethod());
		
		
		chain.doFilter(request, response);
	}

	public void init(FilterConfig fConfig) throws ServletException {
	}

}
